<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on March 29, 2009 at 4:21:25 pm</time-stamp>


<class>
<name>SupplierQuantityReport</name>
<environment>SupplyChain</environment>
<super>UI.SimpleDialog</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>suppliers retailers data </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category></category>
<attributes>
<package>SupplyChain</package>
</attributes>
</class>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<methods>
<class-id>SupplyChain.SupplierQuantityReport class</class-id> <category>instance creation</category>

<body package="SupplyChain" selector="new">new
	^super new initialize.</body>
</methods>

<methods>
<class-id>SupplyChain.SupplierQuantityReport class</class-id> <category>interface specs</category>

<body package="SupplyChain" selector="windowSpec">windowSpec
	"Tools.UIPainter new openOnClass: self andSelector: #windowSpec"

	&lt;resource: #canvas&gt;
	^#(#{UI.FullSpec} 
		#window: 
		#(#{UI.WindowSpec} 
			#label: 
			#(#{Kernel.UserMessage} 
				#key: #EasyChart2 
				#defaultString: 'Supplier Quantity Report' 
				#catalogID: #BGOK ) 
			#min: #(#{Core.Point} 20 20 ) 
			#bounds: #(#{Graphics.Rectangle} 640 512 905 703 ) ) 
		#component: 
		#(#{UI.SpecCollection} 
			#collection: #(
				#(#{UI.ChartViewSpec} 
					#layout: #(#{Graphics.LayoutFrame} 5 0 5 0 -5 1 -5 1 ) 
					#model: #data 
					#dataSeries: 
					#(#{UI.ChartDataSpec} 
						#series: #(
							#(#{UI.ChartDataSetSpec} 
								#name: 'Data1' ) 
							#(#{UI.ChartDataSetSpec} 
								#name: 'Data2' ) 
							#(#{UI.ChartDataSetSpec} 
								#isData: false 
								#name: 'Labels' ) ) ) ) ) ) )</body>
</methods>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<comment>
<class-id>SupplyChain.SupplierQuantityReport</class-id>
<body>SupplierQuantityReport shows a bar chart of quantities of items provided for a specific Item/Supplier by POS Location.

Instance Variables:
	Chart1	&lt;ValueHolder&gt;	A Bar Chart
	retailers	&lt;OrderedCollection&gt;A list of retailers
	suppliers	&lt;OrderedCollection&gt;	 A list of suppliers

</body>
</comment>

<methods>
<class-id>SupplyChain.SupplierQuantityReport</class-id> <category>accessing</category>

<body package="SupplyChain" selector="retailers">retailers
	^retailers</body>

<body package="SupplyChain" selector="retailers:">retailers: anObject
	retailers := anObject</body>

<body package="SupplyChain" selector="suppliers">suppliers
	^suppliers</body>

<body package="SupplyChain" selector="suppliers:">suppliers: anObject
	suppliers := anObject</body>
</methods>

<methods>
<class-id>SupplyChain.SupplierQuantityReport</class-id> <category>initialize-release</category>

<body package="SupplyChain" selector="initialize">initialize
	"Initialize a newly created instance. This method must answer the receiver."

	super initialize.
	" *** Edit the following to properly initialize instance variables ***"
	suppliers := OrderedCollection new.
	retailers := OrderedCollection new.
	" *** And replace this comment with additional initialization code *** "
	^self</body>
</methods>

<methods>
<class-id>SupplyChain.SupplierQuantityReport</class-id> <category>aspects</category>

<body package="SupplyChain" selector="data">data
	"This just formats the data properly for displaying on the chart"
	|outer inner "r1 r2 i1 i2 l1 l2 it1 it2 it3 it4"|
	"r1 := Retailer new.
	r1 name: 'Home Depot'.
	r1 number: '1'.
	r2 := Retailer new.
	r2 name: 'Lowes'.
	r2 number: '2'.
	i1 := Inventory new.
	l1 := Lot new.
	i2 := Inventory new.
	l2 := Lot new.
  	it1 := Item named: 'Video Game' sku:'89X999'.
	it1 quantity: 4.
  	it2 := Item named: 'TV' sku: '99Z837'.
	it2 quantity: 12.
  	it3 := Item named: 'VCR' sku: '54Y3632'.
	it3 quantity: 7.
  	it4 := Item named: 'PC' sku: '01P6373'.
	it4 quantity: 15.
	l1 addItem: it1.
	l2 addItem:it2.
	l1 addItem: it3.
	l2 addItem: it4.
	i1 addItem: it1.
	i2 addItem:it2.
	i1 addItem: it3.
	i2 addItem: it4.
	r1 inventory: i1.
	r2 inventory: i2.
	retailers add: r1.
	retailers add: r2."
	outer := OrderedCollection new.
	retailers do:[:i|
		inner := OrderedCollection new.
		i inventory items do:[:j|
			inner add: (j quantity).].
		inner add: (i name).
		outer add: inner.].
	^outer.</body>
</methods>

</st-source>
